package top.ljlgithub.api.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.ljlgithub.api.bean.User;
import top.ljlgithub.api.mapper.UserMapper;
import top.ljlgithub.api.service.UserService;

import java.util.HashMap;
import java.util.List;

/**
 * @ClassName
 * @Description TODO
 * @Author L1470
 * @Date 2021/5/5 17:12
 * @Version 1.0
 **/
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> userList(String query,Integer pagesize,Integer pagenum) {
        Integer startIndex  = (pagenum - 1) * pagesize;
        List<User> user = userMapper.findUser(query,startIndex,pagesize);
        return user;
    }

    @Override
    public Integer getTotal(String query) {
        Integer total = userMapper.getTotal(query);
        return total;
    }
}
